package com.study.homework;

public class Browser {

    public LinkedStack stack = new LinkedStack();
    public LinkedStack backStack = new LinkedStack();

    public int link(int a) {
        stack.push(a);
        backStack.clear();
        return stack.peek();
    }

    public int back() {
        int pop = stack.pop();
        backStack.push(pop);
        return stack.peek();
    }

    public int forward() {
        int pop = backStack.pop();
        stack.push(pop);
        return stack.peek();
    }
}
